//
// Created by dgy on 2022/11/23.
//
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <cstring>
using namespace std;

map<pair<int, int>, pair<int, int> > from;//t,f
queue<pair<int, int> > q;
int A, B, C;//容量
int x[1000];


pair<int, int> AtoB(pair<int, int> &p)
{
    pair<int, int> p1;
    p1.first = max(0, p.first + p.second - B);
    p1.second = min(B, p.first + p.second);
    return p1;
}

pair<int, int> BtoA(pair<int, int> &p)
{
    pair<int, int> p1;
    p1.first = min(A, p.first + p.second);
    p1.second = max(0, p.first + p.second - A);
    return p1;
}

pair<int, int> emptyA(pair<int, int> &p)
{
    pair<int, int> p1(0, p.second);
    return p1;
}

pair<int, int> emptyB(pair<int, int> &p)
{
    pair<int, int> p1(p.first, 0);
    return p1;
}

pair<int, int> fillA(pair<int, int> &p)
{
    pair<int, int> p1(A, p.second);
    return p1;
}

pair<int, int> fillB(pair<int, int> &p)
{
    pair<int, int> p1(p.first, B);
    return p1;
}

void check(pair<int, int> &f, pair<int, int> &t)
{
    if (from.find(t) == from.end())//没有经历过这种情况
    {
        from[t] = f;
        q.push(t);
    }
}

void judge(pair<int, int> &f, pair<int, int> &t)
{
    if (f.first != 0 && t.first == 0 && f.second == t.second)
        cout << "empty A" << endl;
    else if (f.second != 0 && t.second == 0 && f.first == t.first)
        cout << "empty B" << endl;
    else if (f.first != A && t.first == A && f.second == t.second)
        cout << "fill A" << endl;
    else if (f.second != B && t.second == B && f.first == t.first)
        cout << "fill A" << endl;
    else if (f.second < t.second)
        cout << "pour A B" << endl;
    else
        cout << "pour B A" << endl;
}

int judge2(pair<int, int> &f, pair<int, int> &t)
{
    if (f.first != 0 && t.first == 0 && f.second == t.second)
        //cout << "empty A" << endl;
        return 1;
    else if (f.second != 0 && t.second == 0 && f.first == t.first)
        //cout << "empty B" << endl;
        return 2;
    else if (f.first != A && t.first == A && f.second == t.second)
        //cout << "fill A" << endl;
        return 3;
    else if (f.second != B && t.second == B && f.first == t.first)
        //cout << "fill B" << endl;
        return 4;
    else if (f.second < t.second)
        //cout << "pour A B" << endl;
        return 5;
    else
        //cout << "pour B A" << endl;
        return 6;
}

void print4(pair<int, int> &f, pair<int, int> &t)
{
    if (f.first != 0 && t.first == 0 && f.second == t.second)
        cout << "empty A" << endl;
    else if (f.second != 0 && t.second == 0 && f.first == t.first)
        cout << "empty B" << endl;
    else if (f.first != A && t.first == A && f.second == t.second)
        cout << "fill A" << endl;
    else if (f.second != B && t.second == B && f.first == t.first)
        cout << "fill B" << endl;
    else if (f.second < t.second)
        cout << "pour A B" << endl;
    else
        cout << "pour B A" << endl;

}

void print(pair<int, int> &p)
{
    cout << "???" << endl;
    pair<int, int> f = from[p];
    if (p.first == 0 && p.second == 0)
    {
        judge(f, p);
    }

    else
    {
        return print(f);
        judge(f, p);
        cout << "go!" << endl;
    }
}

void print2(pair<int, int> &p)
{
    while (p.first!=0 || p.second!=0)
    {
        pair<int, int> f = from[p];
        judge(f, p);
        p = f;
    }
}

void print3(pair<int, int> &p)
{
    for(int i=999; i>=0;i--)
    {
        pair<int, int> f = from[p];
        x[i] = judge2(f, p);
        p = f;
        if (p.first == 0 && p.second == 0)
            break;
    }
    for (int i = 0; i < 1000; i++)
    {
        //cout << "aaa" << endl;
        if (x[i] == 0)
            continue;
        switch (x[i])
        {

            case 1:
                cout << "empty A" << endl;
                break;
            case 2:
                cout << "empty B" << endl;
                break;
            case 3:
                cout << "fill A" << endl;
                break;
            case 4:
                cout << "fill B" << endl;
                break;
            case 5:
                cout << "pour A B" << endl;
                break;
            default:
                cout << "pour B A" << endl;
                break;
        }
    }
}

void bfs()
{
    pair<int, int> p1(0, 0);
    q.push(p1);
    from[p1] = p1;
    int a, b;
    while (!q.empty())
    {
        memset(x, 0, sizeof x);
        pair<int, int> f = q.front();
        q.pop();

        pair<int, int> f1 = fillA(f);
        check(f, f1);

        pair<int, int> f2 = fillB(f);
        check(f, f2);

        pair<int, int> f3 = emptyA(f);
        check(f, f3);

        pair<int, int> f4 = emptyB(f);
        check(f, f4);

        pair<int, int> f5 = BtoA(f);
        check(f, f5);

        pair<int, int> f6 = AtoB(f);
        check(f, f6);


        if (f.first == C || f.second == C)
        {
            a = f.first;
            b = f.second;
            break;
        }
    }
    pair<int, int> result(a, b);
    print3(result);
    cout << "success" << endl;
}


int main()
{
    while (cin >> A >> B >> C)
    {
        bfs();
        from.clear();
        while (!q.empty()) q.pop();
    }
    return 0;
}


